/*
 * @Author: EternityJun 2438965023@qq.com
 * @Date: 2025-05-12 09:58:19
 * @LastEditors: EternityJun 2438965023@qq.com
 * @LastEditTime: 2025-05-19 17:25:20
 * @FilePath: \private-domain-small-program\src\service\app\user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/* eslint-disable */
// @ts-ignore
import { CustomRequestOptions } from '@/interceptors/request';
import {miniProgramsRequest,appRequest} from '@/utils/request';

import * as API from './types';
/**
 * app登录 API 接口
 *
 * @param options 自定义请求选项，可选
 * @param data 登录数据
 * @returns 登录结果
 */
export async function loginApi({
  options,
  data
}: {
  options?: CustomRequestOptions;
  data: API.LoginData;
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return appRequest.request<IResData<API.LoginRes>>('/account/login', {
    method: 'POST',
    ...(options || {}),
    data
  });
}



export async function loginYzmApi({
  options,
  data
}: {
  options?: CustomRequestOptions;
  data: API.LoginData;
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return appRequest.request<IResData<API.LoginRes>>('/captcha/login', {
    method: 'POST',
    ...(options || {}),
    data
  });
}
/**
 * 获取验证码
 *
 * @param phone 手机号码
 * @returns 返回 Promise 对象，解析后包含验证码信息
 */
export function getCaptchaCodeApi({
  options,
  phone
}: {
  options?: CustomRequestOptions;
  phone: string;
}) {
  return appRequest.request<IResData<any>>('/captcha', {
    method: 'POST',
    ...(options || {}),
    data: {
      phone
    }
  });
}
/**
 * 获取用户信息 API 接口
 *
 * @param params 请求参数，包括分页信息
 * @param options 自定义请求选项，可选
 * @returns 返回 Promise 对象，解析后包含用户信息
 */
export function getUserInfoApi(
  params: { current: number; page_size: number },
  options?: CustomRequestOptions
) {
  return appRequest.request<IResData<any>>('/my/info', {
    method: 'GET',
    ...(options || {}),
    params, // 将分页参数作为查询参数传递
  });
}



export function inviterInfo(
  params: any,
  options?: CustomRequestOptions
) {
  return appRequest.request<IResData<any>>('/user/inviter/info', {
    method: 'GET',
    ...(options || {}),
    params, // 将分页参数作为查询参数传递
  });
}






export function getWehactStateApi(
  params: any,
  options?: CustomRequestOptions
) {
  return appRequest.request<IResData<any>>('/wehact/status', {
    method: 'GET',
    ...(options || {}),
    params, // 将分页参数作为查询参数传递
  });
}



/** POST 请求 */

export function accountLogin({
  options,
  data
}: {
  options?: CustomRequestOptions;
  data: any;
}) {
  return appRequest.request<IResData<any>>('/account/login', {
    method: 'POST',
    ...(options || {}),
    data
  });
}




export function inviterInfoRequest({
  options,
  data
}: {
  options?: CustomRequestOptions;
  data: any;
}) {
  return appRequest.request<IResData<any>>('/user/bind/inviter', {
    method: 'POST',
    ...(options || {}),
    data
  });
}